﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MvcBlog.ViewModels.EntryViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%: Model.Subject %> 
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <div id="entryHeadline">
    <h2><%: Model.Subject %></h2>
    <%: Model.User.Firstname %> <%: Model.User.Lastname %>, <%: Model.CreateDate %>
    </div>


        <div id="entryText"><p><%: Model.Body %></p></div>
        
        


    <% if (Model.ListOfComments != null)
       {%>
        <fieldset>
            <legend>Kommentare</legend>
            <div id="commentList">
                   <% Html.RenderPartial("CommentList"); %>
            </div>
    
        </fieldset>
    <% } %>

     <% if (Request.IsAuthenticated)
        {
            using (Ajax.BeginForm("Comment", "Entry", new AjaxOptions
            {
                UpdateTargetId = "commentList"
            } ))
            {%>
        <%: Html.ValidationSummary(true)%>

        <fieldset>
        <legend>Beitrag kommentieren</legend>
            
            <div class="editor-field">
                <%: Html.TextAreaFor(model => model.newComment, new { @class = "commentTextarea" })%>
                <%: Html.ValidationMessageFor(model => model.newComment)%>
                <%: Html.HiddenFor(model => model.Entry_ID)%>
            </div>
            
            <p>
                <input type="submit" value="Eintrag kommentieren" />
            </p>
        </fieldset>

    <% }
        } %>


</asp:Content>
